<template>
  <div class="cate">
    <div class="cate_hander">
      <h1 class="cate_title">品类管理 -- 添加品类</h1>
    </div>
    <div class="cate_content">
      <el-form label-position="top" label-width="80px" :model="formLabelAlign">
        <el-form-item label="所属品类">
          <el-select v-model="formLabelAlign.region" placeholder="/所有">
            <el-option label="/所有/王老吉" value="shanghai"></el-option>
            <el-option label="/所有/加多宝" value="beijing"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="品类名称">
          <el-input placeholder="请输入品类名称" v-model="formLabelAlign.name"></el-input>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="onSubmit">提交</el-button>
        </el-form-item>
      </el-form>
    </div>
  </div>
</template>

<script>
import { addcategory } from "../../request/http";
export default {
  data() {
    return {
      formLabelAlign: {
        region: "",
        name: ""
      }
    };
  },
  methods: {
    onSubmit() {
      addcategory({ categoryName: this.formLabelAlign.name }).then(res => {
        console.log(res.data);
        this.$message({
          message: `恭喜你,${res.data.data}`,
          type: "success"
        });
        this.$router.push("/product/index/cate")
      });
    }
  }
};
</script>


<style lang="scss" scoped>
@import "@/Scss/index.scss";
.cate_content {
  @include Wm(95%);
}
.cate_hander {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cate_title {
  display: inline-block;
  font-weight: normal;
}
.cate {
  @include Wm(95%);
}
</style>